<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
</head>
<body>
<div>aaa</div>
<div class="header">bbb</div>
<div id="ab">ccc</div>

<script>
(function (global) {

	function jQuery(selector) {
	    return new jQuery.fn.init(selector)
	}

	jQuery.fn = jQuery.prototype = {
		constructor: jQuery,
	    init:function(selector) {
			    const elements = document.querySelectorAll(selector);

			    for(let i=0;i<elements.length;i++){
				    this[i] =  elements[i];
			    }
			    this.length = elements.length;

		    },
	    css(name, val) {
		    for(let i=0;i<this.length;i++){
			    let element = this[i]
			    element.style[name] = val;
		    }
        }
	}

	jQuery.fn.init.prototype = jQuery.fn
  
    jQuery.extend = function (...args) {
		//这里的extend方法参数并不确定
        //所以不指定形参，通过arguments来进行操作
        let target = args[0];
        //进行对象拷贝
		for(let i=1;i<args.length;i++){
			let arg = args[i]
		  //取出对象中的第个属性
		    for(let key in arg){
				let val = arg[key]
		        //把该属性参加到第一个属性中
			    target[key] = val;
				// target[key] = arg[key]
		    }
		}
		return target;
    }

	global.$ = global.jQuery = jQuery;

})(window)

	var obj = {name:'xxx',age:18}
	var obj3 = {gender:'女'}
	var p = {}
	$.extend(p,obj,obj3)
</script>
</body>
</html>